#ifndef INC_UCTNODE
#define INC_UCTNODE

#include "math.h"
#include "board.h"
#include "node.h"


class UCTNode
{
	public:
			UCTNode();
			UCTNode(Board * tab, Node* node);
			UCTNode(Board * tab, bool newColor);
			~UCTNode();
			double UCTFormula();
			UCTNode* updateUCTValuesDown (UCTNode* node, int & resultX, int & resultY);
			void updateUCTValuesUp (UCTNode* node, int &prevCaptX, int &prevCaptY, bool &stop, int color);
			int getNbWins();
			int getNbVisited();
			void setNbWins(int increment);
			void setBoard(Board *newBoard);
			void setNbVisited(int increment);
			void setEvalValue (double value);
			double getEvalValue ();
			void setOrigins(int x, int y);
			void setPos(int posx, int posy);
			int getPosX();
			int getPosY();
			int getXOrigin();
			int getYOrigin();
			void setParent(UCTNode* node);
			void setChild(UCTNode* node);
			void setNextSibling(UCTNode* node);
			void setPrevSibling(UCTNode* node);
			UCTNode* getParent();
			UCTNode* getChild();
			UCTNode* getNextSibling();
			UCTNode* getPrevSibling();
			Board* getBoard();
			void setColor(bool couleur);
			bool getColor();
			void launchUCT(bool color, Board* currentBoard, int &prevX, int &prevY, int &prevCaptX, int &prevCaptY, int &resultX, int &resultY, bool &pass);
			void launchUCT2(UCTNode * startNode, UCTNode * maxNode, int &prevCaptX, int &prevCaptY , int &resultX, int &resultY, bool &stop, bool color);
			void firstUCTDevelop (UCTNode* node, int &prevX, int &prevY, int &prevCaptX, int &prevCaptY, bool &pass, bool color);

	private:
			UCTNode* parent;
			UCTNode* nextSibling;
			UCTNode* prevSibling;
			UCTNode* child;
			int victory;
			int visits;
			int x;
			int y;
			int xOrigin;
			int yOrigin;
			double evalValue;
			Board* board;
			bool color;
};

#endif